<?php
/**
 * Created by jinqiang on 2024/9/12 11:12.
 * Copyright (c) 2024, Your Company. All rights reserved.
 */


namespace App\Http\Controllers\Soa;


use App\Http\Controllers\Controller;
use App\Http\Services\Soa\FineService;
use Illuminate\Http\Request;

class FineController extends Controller
{
    public function list(Request $request, FineService $fineService)
    {
        $this->validate($request, [
            'page' => 'required',
            'limit' => 'required'
        ]);
        $param = $request->all();
        $res = $fineService->search($param);
        return result($res);
    }

    //违约赔偿审核进度
    public function approvalProcess(Request $request, FineService $fineService)
    {
        $this->validate($request, [
            'id' => 'required',
            'run_id' => 'required',
        ]);
        $param = $request->all();
        $res = $fineService->approvalProcess($param);
        return result($res);
    }

    //创建违约赔偿
    public function create(Request $request, FineService $fineService)
    {
        $param = $request->all();
        $res = $fineService->create($param);
        return $res['code'] === 0 ? success("违约赔偿创建成功, 请耐心等待审批结果...") : error($res['msg'], $res);
    }
}
